/*
 * fstlab.fx
 *
 * Created on 20.03.2010, 1:38:41
 */
 package trunk.JavaFX179Labs.src.javafx191labs.rtyurin.lab01;

class Dimarray {
    public var dimX:Integer;
    public var dimY:Integer;

    public var elems: Circle[];

    public function getElem(n: Integer, m:Integer){
        return elems[dimY * n + m ];
    }





};




/**
 * @author Axi
 */

import java.util.*;

import javafx.stage.*;
import javafx.scene.*;
import javafx.animation.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
def pon  = Dimarray{
        dimX:6;
        dimY:6;
        
        }


var colors = [Color.GREEN, Color.BLUE, Color.ORANGE, Color.YELLOW];

var content:Node[];
var tempo =[1..20];
var temp:Circle[]= for (color in colors) Circle{
                    centerX: 20 + 20*indexof color
                    centerY: 20
                    radius:  30
                    fill: Color.GREEN

                };

import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;
import javafx.scene.input.MouseEvent;


class Cells extends CustomNode {
    override function create():Node {
            var pon:Number =1.40 ;
            
        return Group {
            content:[for(y in [0..10])
                    for(x in [0..10]) {
                Polygon{ points:[ 30,30,
                              50,30,
                              64,43,
                              50,56,
                              30,56,
                              16,43,
                              30,30]
                    var color= Color.CYAN;
                    fill: bind color;
                   layoutX: if (y/2*2!=y) x*48*pon+33 else x*48*pon;
                   layoutY:y*13;
                  onMouseEntered: function (e: MouseEvent): Void {
                   color= Color.RED;}
onMouseExited: function( e: MouseEvent ):Void {
 color=Color.CYAN;


}

                  

                                }}
                   for(y in [0..10])
                   for(x in [0..10]){

                   Polyline{ points:[30,30,
                              50,30,
                              64,43,
                              50,56,
                              30,56,
                              16,43,
                              30,30]
                       stroke: Color.BLACK
                       strokeWidth: 2 //       3-5              2-8
                       layoutX:if (y/2*2!=y) x*48*pon+33 else x*48*pon;
                   layoutY:y*13;}
            }]
        };
    }
}

             //  Group {content: bind content;}
Stage {
    title: "Declaring Is Easy!"
    scene: Scene {
        width: 300
        height: 250

        content:[Cells{ }]
       } }

      

            //content






//        content: [
//             Polyline{ points:[30,30,
//                              50,30,
//                              64,43,
//                              50,56,
//                              30,56,
//                              16,43,
//                              30,30]
//                       stroke: Color.BLACK
//                       strokeWidth: 2


         // }//polyline


